import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import {render} from "@/utils/common/renderUtils";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '生产车间',
    align: "center",
    dataIndex: 'feeder',
    sorter: true,
    customRender: ({ text }) => {
      return render.renderDict(text, 'feeder');
    },
  },
  {
    title: '供料机',
    align: "center",
    dataIndex: 'productFloor',
    sorter: true
  },
  {
    title: '换模开始时间',
    align: "center",
    dataIndex: 'starTime',
    sorter: true
  },
  {
    title: '换模结束时间',
    align: "center",
    dataIndex: 'endTime',
    sorter: true
  },
  {
    title: '产品规格名称',
    align: "center",
    dataIndex: 'productSpecsName'
  },
  {
    title: '技术标准号',
    align: "center",
    dataIndex: 'skillStandardNumber'
  },
  {
    title: '班组负责人',
    align: "center",
    dataIndex: 'inspector'
  },
  {
    title: '车间负责人',
    align: "center",
    dataIndex: 'classHead'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'productFloor',
    label: '供料机',
    component: 'Input',
    colProps: { span: 6 },
  },{
    field: 'productSpecsName',
    label: '产品名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '生产车间',
    field: 'feeder',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'feeder',
      placeholder: '请选择车间',
      stringToNumber: true,
    },
  },
  {
    label: '供料机',
    field: 'productFloor',
    component: 'Input'
  },
  {
    label: '换模开始时间',
    field: 'starTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '换模结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '产品规格名称',
    field: 'productSpecsName',
    component: 'Input',
  },
  {
    label: '技术标准号',
    field: 'skillStandardNumber',
    component: 'Input',
  },
  {
    label: '班组负责人',
    field: 'inspector',
    component: 'Input',
  },
  {
    label: '车间负责人',
    field: 'classHead',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  feeder: { title: '生产车间', order: 0, view: 'text', type: 'string', },
  productFloor: { title: '供料机', order: 1, view: 'text', type: 'string', },
  starTime:{ title: '换模开始时间', order: 2, view: 'text', type: 'string', },
  endTime:{ title: '换模结束时间', order: 3, view: 'text', type: 'string', },
  productSpecsName: { title: '产品规格名称', order: 4, view: 'text', type: 'string', },
  skillStandardNumber: { title: '技术标准号', order: 5, view: 'text', type: 'string', },
  inspector: { title: '班组负责人', order: 6, view: 'text', type: 'string', },
  classHead: { title: '车间负责人', order: 7, view: 'text', type: 'string', },
  remark: { title: '备注', order: 8, view: 'text', type: 'string', },


};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
